package com.grocery.controller;

import com.grocery.bean.Cartitem;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping("page")
public class PageController {
    @RequestMapping("product")
    public String product() {
        return "system/product";
    }

    @RequestMapping("order")
    public String order() {
        return "system/order";
    }

    @RequestMapping("orders")
    public String orders() {
        return "front/orders";
    }

    @RequestMapping("category")
    public String category() {
        return "system/category";
    }

    @RequestMapping("index")
    public String index() {
        return "front/index";
    }

    @RequestMapping("mycount")
    public String mycount() {
        return "front/my-account";
    }

    @RequestMapping("cart")
    public String cart() {
        return "front/shopping-cart";
    }

    @RequestMapping("productdetails")
    public String productdetails() {
        return "front/product-details";
    }

    @RequestMapping("products")
    public String products() {
        return "front/products";
    }

    @RequestMapping("editaddress")
    public String editaddress() {
        return "front/edit-address";
    }

    @RequestMapping("editprofile")
    public String editprofile() {
        return "front/edit-profile";
    }

    @RequestMapping("password")
    public String password() {
        return "front/password";
    }

    @RequestMapping("address")
    public String address() {
        return "front/address";
    }

    @RequestMapping("dashboard")
    public String dashboard() {
        return "front/dashboard";
    }

    @RequestMapping("addaddress")
    public String addaddress() {
        return "front/add-address";
    }

    @RequestMapping("putid")
    public String product(Integer id, Model model){
        model.addAttribute("id",id);
        return "front/product-details";
    }

    @RequestMapping("putaddid")
    public String putaddid(Integer id, Model model){
        model.addAttribute("addid",id);
        return "front/edit-address";
    }


    @RequestMapping("check")
    public String checkout(String productid,String number,Model model) {
        model.addAttribute("productid",productid);
        model.addAttribute("number",number);
        return "front/checkout";
    }

    @RequestMapping("payment")
    public String payment(Integer id, Model model){
        model.addAttribute("id",id);
        return "front/payment";
    }

    @RequestMapping("categoryproducts")
    public String categoryproducts(int pid, Model model){
        model.addAttribute("pid",pid);
        return "front/category-products";
    }

}
